feat(ev-deployer): part 3a - add live chain deployment via CREATE2#200
feat(ev-deployer): part 3a - add live chain deployment via CREATE2#200randygrok wants to merge 19 commits intoev-deployer-part3-permit2from
Conversation
Prepares for the deploy subcommand where addresses are determined by CREATE2, not by user config. Genesis mode validates addresses are present.
Embeds creation bytecodes alongside existing runtime bytecodes. Extracts expected_runtime_bytecode for Permit2 verification.
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Claude finished @randygrok's task —— View job Code Review for ev-deployer Part 3a - Live Chain DeploymentReviewing the implementation of live chain deployment via CREATE2 for the ev-deployer tool. Todo List
Review SummaryThis is a solid implementation of live chain deployment functionality that extends ev-deployer beyond genesis alloc generation. The architecture is well-designed with clear separation of concerns and proper abstractions. ✅ Positive Aspects
🔧 Areas for Improvement1. Missing AdminProxy SupportThe pipeline only handles Permit2 deployment but the config supports AdminProxy. Need to add AdminProxy deployment logic in // bin/ev-deployer/src/deploy/pipeline.rs:226-238
fn get_contract_status(state: &DeployState, name: &str) -> Option<ContractStatus> {
if name == "permit2" {
state.contracts.permit2.as_ref().map(|c| c.status)
} else {
None // AdminProxy support missing
}
}2. Error Handling Improvements
3. Security Considerations
4. Configuration Design ConcernMaking // bin/ev-deployer/src/config.rs:61-62
pub struct AdminProxyConfig {
/// Address to deploy at (required for genesis, ignored for deploy).
pub address: Option<Address>,This could be clearer with separate config types for genesis vs deploy modes. 5. Test Coverage Gaps
6. Documentation & UX
🏗️ Architecture CommentsThe trait-based design is excellent and allows for easy testing and future extensibility. The separation between CREATE2 computation, state management, and deployment orchestration is well thought out. 🧪 Test QualityThe existing tests are well-structured with good coverage of core logic:
📊 Performance Considerations
🚀 Recommendations
This is a high-quality implementation that demonstrates good Rust practices and thoughtful system design. The main gap is the incomplete contract support, but the foundation is solid for future extensions. |
AdminProxy has an empty constructor and sets owner via genesis storage slot 0, making it incompatible with live CREATE2 deployment where the owner would remain address(0). Restrict AdminProxy to genesis-only mode.
Write to a .tmp file first, then rename into place. Prevents state file corruption if the process crashes mid-write.
Inject Nick's CREATE2 factory (0x4e59b44847b379578588920ca78fbf26c0b4956c) into genesis state so ev-deployer deploy works on post-merge chains where the canonical keyless transaction cannot land. Genesis-only — the deploy pipeline already validates its existence on-chain.
Summary
Adds a
deploysubcommand toev-deployerfor deploying AdminProxy and Permit2 contracts to a live chain via CREATE2 using the deterministic deployer factory.Previously,
ev-deployercould only generate genesis alloc JSON for pre-genesis deployment. This PR adds the ability to deploy the same contracts to an already-running chain, with deterministic addresses, state persistence, and idempotent resume.Key changes
addressis nowOption<Address>in contract configs. Required forgenesismode (validated at runtime), ignored indeploymode where CREATE2 determines the address.0x4e59b44847b379578588920ca78fbf26c0b4956c).pending→deployed→verified). Immutability checks prevent config drift between runs.get_code,deploy_create2).LiveDeployerimplements it with alloy provider + signer.Usage
The state file is created on first run and reused on subsequent runs for resumability. If a deploy is interrupted, re-running the same command picks up where it left off.